<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;
//测试控制器
class IndexController extends CommonController{
 //动作
    public function index(){
    	$data =Db::table("article")->where("is_recycle",0)
    	->join("category","cid","=","category_cid")
		->join("article_data","article_aid","=","aid")
		->orderBy("click","DESC")
		->limit(2)
    	->get();
		foreach ($data as $k => $v) {
			  	$data[$k]['tag'] = Db::table("article_tag")
				->join("tag","tid","=","tag_tid")
				->where("article_aid",$v['aid'])
				->lists("tid,tname");
			}
		View::with("data",$data);
        View::make();
    }
}
